import { Component } from '@angular/core';
import { NzMessageService, NzModalRef } from 'ng-zorro-antd';
import { SFSchema } from '@delon/form';
@Component({
  selector: 'app-admin-edit',
  templateUrl: './edit.component.html',
})
export class SystemAdminEditComponent {
  i: any = {};
  accountInfo: string = '新增管理员';
  schema: SFSchema = {
    properties: {
      account: { type: 'string', title: '名称', maxLength: 50 },
      password: { type: 'string', title: '密码'},
      role: {
        type: 'string',
        title: '角色',
        enum: [
          { value: '系统管理员', label: '系统管理员' },
          { value: '高级管理员', label: '高级管理员' },
          { value: '普通管理员', label: '普通管理员' },
          { value: '员工', label: '员工' }
        ]
      },
      status: {
        type: 'string',
        title: '状态',
        enum: [
          { value: '开启', label: '开启' },
          { value: '关闭', label: '关闭' }
        ]
      }
    },
    required: ['account', 'password', 'role', 'status'],
    ui: {
      spanLabelFixed: 80,
      grid: { span: 24 },
    },
  };
  constructor(private modal: NzModalRef, private msgSrv: NzMessageService) {}
  save(value: any) {
    this.msgSrv.success('保存成功');
    this.modal.close(value);
  }
  close() {
    this.modal.destroy();
  }
}
